#include "PreComplie.h"
#include "Node.h"

namespace Behavior
{

#define RegisterCondition(ConditionName)\
	{\
		ICondition* pCondition = new ConditionName();\
		m_pConditions[pCondition->ID()] = pCondition;\
	}

XConditionFactory::XConditionFactory()
{
	memset(m_pConditions, NULL, sizeof(m_pConditions));
	RegisterCondition(XConditionTrue);
	RegisterCondition(XConditionFalse);
	//RegisterCondition(XConditionAnd);
	//RegisterCondition(XConditionOr);
	//RegisterCondition(XConditionNot);
	//RegisterCondition(XConditionXOr);
}

ICondition* XConditionFactory::GetCondition(ICondition::ConditonID id)
{
	assert(id >= 0 && id < ICondition::eCondtionMax);
	return m_pConditions[id];
}

XConditionFactory::~XConditionFactory()
{
	for(int index = 0; index < ICondition::eCondtionMax; ++index)
	{
		delete m_pConditions[index];
	}
}

}
